<?php 	
	global $SSO, $Security, $AppID, $User, $DB;
	//Check to see if there is a valid session 
	$SessionInfo = $SSO->isValidSession("index.php?action=login", $SSO->getSessionInformation());	
	
	//Check to see if the user has rights to be on LWAdmin
	$PageRights = array('ADMIN', 'USERADMIN');
	$Security->ValidateUser($SessionInfo['username'], $AppID, $PageRights, 1);

	$validator = new FormValidation();

	function GetStateOptions($state_to_match)
	{
		global $DB;
		$Options = "";
		$DB->query("SELECT * FROM states");
		while($row = $DB->fetch_row())
		{	
			if($row['StateCode'] == $state_to_match)
			{			
				$Options = $Options . '<option selected value="' . $row['StateCode'] . '">' . $row['StateName'] . '</option>';
			}
			else
			{
				$Options = $Options . '<option value="' . $row['StateCode'] . '">' . $row['StateName'] . '</option>';
			}
		}
		
		return $Options;
	}
?>
<input type="hidden" value="<?php if(isset($_GET['username'])){print $_GET['username'];} elseif(isset($_POST['val_username'])){print $_POST['val_username'];}?>" name="username">
<table cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td><img src="images/1pixel.gif" height="6" border="0" alt=""></td>
	</tr>
	<tr>
		<td>
			<table width="100%" cellpadding="3" cellspacing="0" border="0">
				<!-- FIRST NAME -->
				<tr>
					<td align="right">
						<span class="T1">First Name</span>
					</td>
					<td>
						<input type="text" name="txtFirstName" value="<?php print $validator->getPostIfSet("val_txtFirstName"); ?>" size="20" maxlength="15" class="T1">
					</td>
				</tr>
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtFirstName"); ?></span>
					</td>
				</tr>
			<!-- MIDDLE NAME 
				<tr>
					<td align="right">
						<span class="T1">Middle Name</span>
					</td>
					<td>
						<input type="text" name="txtMiddleName" value="<?php print $validator->getPostIfSet("val_txtMiddleName"); ?>" size="20" maxlength="15" class="T1">
					</td>
				</tr>
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtMiddleName"); ?></span>
					</td>
				</tr>-->
				<!-- LAST NAME -->
				<tr>
					<td align="right">
						<span class="T1">Last Name</span>
					</td>
					<td>
						<input type="text" name="txtLastName" value="<?php print $validator->getPostIfSet("val_txtLastName"); ?>" size="20" maxlength="30" class="T1">
					</td>
				</tr>
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtLastName"); ?></span>
					</td>
				</tr>
				<!-- PHONE -->
<!--				<tr>
					<td align="right">
						<span class="T1">Home Phone</span>
					</td>
					<td >
						<input type="text" name="txtHomePhone" value="<?php print $validator->getPostIfSet("val_txtHomePhone"); ?>" size="16" maxlength="19" class="T1">
					</td>
				</tr> 
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtHomePhone"); ?></span>
					</td>
				</tr>
				<tr>
					<td align="right">
						<span class="T1">Work Phone</span>
					</td>
					<td >
						<input type="text" name="txtWorkPhone" value="<?php print $validator->getPostIfSet("val_txtWorkPhone"); ?>" size="16" maxlength="19" class="T1">
					</td>
				</tr> -->
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtWorkPhone"); ?></span>
					</td>
				</tr>
				<!-- EMAIL -->
				<tr>
					<td align="right">
						<span class="T1">E-Mail</span>
					</td>
					<td>
						<input type="text" name="txtEmail" value="<?php print $validator->getPostIfSet("val_txtEmail"); ?>" size="25" maxlength="59" class="T1">
					</td>
				</tr>
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtEmail"); ?></span>
					</td>
				</tr>
				<!-- ADDRESS 
				<tr>
					<td align="right">
						<span class="T1">Address</span>
					</td>
					<td >
						<input type="text" name="txtAddress1" value="<?php print $validator->getPostIfSet("val_txtAddress1"); ?>" size="25" maxlength="45" class="T1">
					</td>
				</tr>
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtAddress1"); ?></span>
					</td>
				</tr>
				<tr>
					<td align="right">
						<span class="T1">&nbsp;</span>
					</td>
					<td>
						<input type="text" name="txtAddress2" value="<?php print $validator->getPostIfSet("val_txtAddress2"); ?>" size="25" maxlength="45" class="T1">
					</td>
				</tr>
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtAddress2"); ?></span>
					</td>
				</tr>-->
				<!-- CITY 
        <tr>
					<td align="right">
						<span class="T1">City</span>
					</td>
					<td >
						<input type="text" name="txtCity" value="<?php print $validator->getPostIfSet("val_txtCity"); ?>" size="25" maxlength="25" class="T1">
					</td>
				</tr>
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtCity"); ?></span>
					</td>
				</tr>-->
				
				<!-- STATE 
        <tr>
					<td align="right">
						<span class="T1">State/Province</span>
					</td>
					<td>
						<select name="sbxState" class="T1">
							<option value=""></option>
							<?php print GetStateOptions($validator->getPostIfSet("val_sbxState")); ?>
						</select>
					</td>
				</tr>
				<tr>-->
				
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_sbxState"); ?></span>
					</td>
				</tr>
				<!-- ZIP POSTAL 
				<tr>
					<td align="right">
						<span class="T1">Zip/Postal Code</span>
					</td>
					<td><input type="text" name="txtZip" value="<?php print $validator->getPostIfSet("val_txtZip"); ?>" size="10" maxlength="10" class="T1"></td>
				</tr>
				<tr>
					
					<td colspan="2" align="center">
						<span class="T0" style="color:#FF0000"><?php print $validator->getPostIfSet("err_txtZip"); ?></span>
					</td>
				</tr>-->
				<tr>
					<td>&nbsp;
					</td>
				</tr>
				<tr>
					<td align="center" colspan="2">
						<input type="submit" name="btnSubitInfo" class="B" value="Submit Info">&nbsp;&nbsp;&nbsp;
						<input type="button" name="btnCancel" class="B" value="Cancel" onClick="location.href='index.php?action=users';">
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td><img src="images/1pixel.gif" height="6" border="0" alt=""></td>
	</tr>
</table>
